import request from '@/utils/request'

// 查询
export function query(data) {
  return request({
    url: `/mes/m/repair/upkeep/list?page=${data.page.current}&pageSize=${data.page.size}`,
    method: 'post',
    data
  })
}

export function batchRemove(data) {
  return request({
    url: `/mes/m/repair/upkeep/delete`,
    method: 'delete',
    data
  })
}

export function detailUpKeep(id) {
  return request({
    url: `/mes/m/repair/upkeep/getById/${id}`,
    method: 'get'
  })
}

export function saveUpkeep(data) {
  return request({
    url: `/mes/m/repair/upkeep/execute/saveRepairTable`,
    method: 'put',
    data
  })
}

export function queryById() {
  return request({
    url: `/mes/m/repair/upkeep/execute/getById`,
    method: 'get'
  })
}

// 保养列表查看 根据保养单编号获取详情
export function queryUpkeepById(repairId) {
  return request({
    url: `/mes/m/repair/upkeep/execute/getByRepairId/${repairId}`,
    method: 'get'
  })
}

// 查询保养单列表
export function queryRepairTable(data) {
  return request({
    url: `/mes/m/repair/upkeep/execute/queryRepairTable`,
    method: 'post',
    data
  })
}

export function queryExecute(data) {
  return request({
    url: `/mes/m/repair/upkeep/execute/list?page=${data.page.current}&pageSize=${data.page.size}`,
    method: 'post',
    data
  })
}

// 保养列表根据repairId删除
export function batchRemoveList(data) {
  return request({
    url: `/mes/m/repair/upkeep/execute/deleteByRepairId`,
    method: 'DELETE',
    data
  })
}
// 保养执行根据id删除
export function batchRemoveExecute(data) {
  return request({
    url: `/mes/m/repair/upkeep/execute/delete`,
    method: 'DELETE',
    data
  })
}
export function queryUpkeepByDeviceType(deviceType, upkeepPlanName) {
  return request({
    // BaseURL:'',
    // url: `http://localhost:19004/m/repair/upkeep/execute/queryByDeviceType?deviceType=${deviceType}&upkeepPlanName=${upkeepPlanName}`,
    url: `/mes/m/repair/upkeep/execute/queryByDeviceType?deviceType=${deviceType}&upkeepPlanName=${upkeepPlanName}`,
    method: 'get'
  })
}
